import { BASIC_FLAG } from "$utils/enum";
import { getImg } from "$utils/imgs";
import { transitionParams, verifyPc } from "$utils/index";
import { setScrollHeigth } from "$utils/table";

export default {
  data() {
    return {
      title: "",
      basicFlag: BASIC_FLAG,
    }
  },
  methods: {
    setScrollStyle(otherH = 0) {
      // pc 端有导航栏  需要去除导航栏高度
      const otherHeight = (verifyPc() ? 40 : 0) + otherH
      return setScrollHeigth(0, otherHeight)
    },
    setImgUrl(item) {
      const url = getImg(item.selectBg)
      return url
    },
    pageSkip(url, item, flag) {
      let params = {}
      if (this.basicFlag.ADD === flag) {
        params = {
          taskDate: null,
          useFlag: flag
        }
        uni.navigateTo({
          url: transitionParams(params, url, this.addForm.form),
        });
      } else {
        params = {
          id: null,
          priority: null,
          planTime: null,
          taskName: null,
          taskType: null,
          taskDate: null,
          selctColor: null,
          selectBg: null,
          useFlag: flag

        }
        console.log(transitionParams(params, url, item), " transitionParams(params, url, item),");
        uni.navigateTo({
          url: transitionParams(params, url, item),
        });
      }
    }
  }
}
